'use strict';

/**
 * @ngdoc overview
 * @name viewApp
 * @description
 * # viewApp
 *
 * Main module of the application.
 */
var app = angular.module('nodeApp', [
  'ui.router',
  'ngAnimate',
  'ngSanitize',
  'ngResource'
]);

app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
  $stateProvider
    .state('index', {
      url: '/',
      templateUrl: 'views/index.html',
      controller: 'IndexCtrl'
    })
    .state('index.list', {
      url: ':cate/:tag/:page',
      templateUrl: 'views/index.html',
      controller: 'IndexCtrl'
    })
    .state('admin', {
      url: '/admin',
      templateUrl: '/login'
    })
    .state('article', {
      url: '/article/{id}',
      templateUrl: 'views/article.html',
      controller: 'ArticleCtrl'
    });
  $urlRouterProvider.otherwise('/');
  //$locationProvider.html5Mode(true);
});
app.controller('mainCtrl', function ($scope, $http, $state) {
  $scope.navs = [];
  $http.get('/nav').then(function (res) {
    $scope.navs = res.data;
  });

  $scope.index = function () {
    $state.go('index', {}, {reload: true});
  };
});
var log = console.log.bind(console);

var duoshuoQuery = {short_name: "nodeblog"};

